$OpenBSD: patch-Makefile,v 1.25 2014/09/29 09:26:00 dcoppa Exp $
--- Makefile.orig	Sun Sep 28 15:17:29 2014
+++ Makefile	Mon Sep 29 11:13:08 2014
@@ -6,24 +6,8 @@ LIBDIR:=${PREFIX}/lib
 INCDIR:=${PREFIX}/include
 MANDIR:=${PREFIX}/share/man
 DYNLINK:=0
+CFLAGS+=-std=c99 -fgnu89-inline
 
-# Respect environment variables set by user; does not work with :=
-ifeq (${CFLAGS},)
-	CFLAGS=-O2 -DNDEBUG
-endif
-ifeq (${CC},cc)
-	OS := $(shell uname)
-	ifeq (${OS},Darwin)
-		CC=gcc -std=c99
-	else ifeq (${OS},FreeBSD)
-		CC=cc -std=c99
-	else ifeq (${OS},OpenBSD)
-		CC=cc -std=c99
-	else
-		CC=c99
-	endif
-endif
-
 PIANOBAR_DIR:=src
 PIANOBAR_SRC:=\
 		${PIANOBAR_DIR}/main.c \
@@ -95,27 +79,21 @@ ALL_LDFLAGS:=${LDFLAGS} -lao -lpthread -lm \
 
 # build pianobar
 ifeq (${DYNLINK},1)
-pianobar: ${PIANOBAR_OBJ} ${PIANOBAR_HDR} libpiano.so.0
-	@echo "  LINK  $@"
-	@${CC} -o $@ ${PIANOBAR_OBJ} -L. -lpiano ${ALL_LDFLAGS}
+pianobar: ${PIANOBAR_OBJ} ${PIANOBAR_HDR} libpiano.so.${LIBpiano_VERSION}
+	${CC} -o $@ ${PIANOBAR_OBJ} -L. -lpiano ${ALL_LDFLAGS}
 else
 pianobar: ${PIANOBAR_OBJ} ${PIANOBAR_HDR} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} \
 		${LIBWAITRESS_HDR}
-	@echo "  LINK  $@"
-	@${CC} -o $@ ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} \
+	${CC} -o $@ ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} \
 			${ALL_LDFLAGS}
 endif
 
 # build shared and static libpiano
-libpiano.so.0: ${LIBPIANO_RELOBJ} ${LIBPIANO_HDR} ${LIBWAITRESS_RELOBJ} \
+libpiano.so.${LIBpiano_VERSION}: ${LIBPIANO_RELOBJ} ${LIBPIANO_HDR} ${LIBWAITRESS_RELOBJ} \
 		${LIBWAITRESS_HDR} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ}
-	@echo "  LINK  $@"
-	@${CC} -shared -Wl,-soname,libpiano.so.0 -o libpiano.so.0.0.0 \
+	${CC} -shared -o libpiano.so.${LIBpiano_VERSION} \
 			${LIBPIANO_RELOBJ} ${LIBWAITRESS_RELOBJ} ${ALL_LDFLAGS}
-	@ln -s libpiano.so.0.0.0 libpiano.so.0
-	@ln -s libpiano.so.0 libpiano.so
-	@echo "    AR  libpiano.a"
-	@${AR} rcs libpiano.a ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ}
+	${AR} rcs libpiano.a ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ}
 
 
 -include $(PIANOBAR_SRC:.c=.d)
@@ -124,17 +102,14 @@ libpiano.so.0: ${LIBPIANO_RELOBJ} ${LIBPIANO_HDR} ${LI
 
 # build standard object files
 %.o: %.c
-	@echo "    CC  $<"
-	@${CC} -c -o $@ ${ALL_CFLAGS} -MMD -MF $*.d -MP $<
+	${CC} -c -o $@ ${ALL_CFLAGS} -MMD -MF $*.d -MP $<
 
 # create position independent code (for shared libraries)
 %.lo: %.c
-	@echo "    CC  $< (PIC)"
-	@${CC} -c -fPIC -o $@ ${ALL_CFLAGS} -MMD -MF $*.d -MP $<
+	${CC} -c -fPIC -o $@ ${ALL_CFLAGS} -MMD -MF $*.d -MP $<
 
 clean:
-	@echo " CLEAN"
-	@${RM} ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} ${LIBWAITRESS_OBJ}/test.o \
+	${RM} ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} ${LIBWAITRESS_OBJ}/test.o \
 			${LIBPIANO_RELOBJ} ${LIBWAITRESS_RELOBJ} pianobar libpiano.so* \
 			libpiano.a waitress-test $(PIANOBAR_SRC:.c=.d) $(LIBPIANO_SRC:.c=.d) \
 			$(LIBWAITRESS_SRC:.c=.d)
@@ -152,18 +127,16 @@ install: pianobar install-libpiano
 else
 install: pianobar
 endif
-	install -d ${DESTDIR}${BINDIR}/
-	install -m755 pianobar ${DESTDIR}${BINDIR}/
-	install -d ${DESTDIR}${MANDIR}/man1/
-	install -m644 contrib/pianobar.1 ${DESTDIR}${MANDIR}/man1/
+	${INSTALL_DATA_DIR} ${DESTDIR}${BINDIR}/
+	${INSTALL_PROGRAM} pianobar ${DESTDIR}${BINDIR}/
+	${INSTALL_DATA_DIR} ${DESTDIR}${MANDIR}/man1/
+	${INSTALL_MAN} contrib/pianobar.1 ${DESTDIR}${MANDIR}/man1/
 
 install-libpiano:
-	install -d ${DESTDIR}${LIBDIR}/
-	install -m644 libpiano.so.0.0.0 ${DESTDIR}${LIBDIR}/
-	ln -s libpiano.so.0.0.0 ${DESTDIR}${LIBDIR}/libpiano.so.0
-	ln -s libpiano.so.0 ${DESTDIR}${LIBDIR}/libpiano.so
-	install -m644 libpiano.a ${DESTDIR}${LIBDIR}/
-	install -d ${DESTDIR}${INCDIR}/
-	install -m644 src/libpiano/piano.h ${DESTDIR}${INCDIR}/
+	${INSTALL_DATA_DIR} ${DESTDIR}${LIBDIR}/
+	${INSTALL_DATA} libpiano.so.${LIBpiano_VERSION} ${DESTDIR}${LIBDIR}/
+	${INSTALL_DATA} libpiano.a ${DESTDIR}${LIBDIR}/
+	${INSTALL_DATA_DIR} ${DESTDIR}${INCDIR}/
+	${INSTALL_DATA} src/libpiano/piano.h ${DESTDIR}${INCDIR}/
 
 .PHONY: install install-libpiano test debug all
